<!DOCTYPE html>
<title>View transitions: prerender navigation helper</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/">
<link rel="author" href="mailto:vmpstr@chromium.org">
<script src="/speculation-rules/prerender/resources/utils.js"></script>
<style>
@view-transition { navigation: auto; }
html { background: red; }
div {
  width: 200px;
  height: 200px;
  background: red;
  color: black;
  position: absolute;
  top: 40px;
  right: 8px;
  view-transition-name: target;
}
::view-transition {
  background: lightblue;
}
::view-transition-group(root) {
  visibility: hidden;
  animation-duration: 500s;
}
::view-transition-group(target) {
  animation-play-state: paused;
}
::view-transition-new(target) {
  animation: unset;
  opacity: 1;
}
::view-transition-old(target) {
  animation: unset;
  opacity: 0;
}
</style>
<div id=target>
  There should be a green square on the left side of the screen,
  on a field of lightblue. There should be no red in the final state.
</div>
<script>
if (document.prerendering) {
  target.style.background = "green";
}
const channel = new PrerenderChannel('prerender-channel');
channel.postMessage('loaded!');
</script>
